# -*- coding:UTF-8 -*-


import datetime
import time


DEBUG = "debug"
INFO = "info"
ERROR = "error"

BREAK_FLAG = 1

URL1 = "http://stock.xueqiu.com/v5/stock/chart/kline.json?symbol={}&begin={}&period=1m&type=before&count=-{}&indicator=kline,pe,pb,ps,pcf,market_capital,agt,ggt,balance"
URL5 = "http://stock.xueqiu.com/v5/stock/chart/kline.json?symbol={}&begin={}&period=5m&type=before&count=-{}&indicator=kline,pe,pb,ps,pcf,market_capital,agt,ggt,balance"
URLDAY = "http://stock.xueqiu.com/v5/stock/chart/kline.json?symbol={}&begin={}&period=day&type=before&count=-{}&indicator=kline,pe,pb,ps,pcf,market_capital,agt,ggt,balance"

TIMEOUT = 3


DATA_DB = "data_one"
HISTORY_DB = "history_one"

DATA_DB_FIVE = "data_five"
HISTORY_DB_FIVE = "history_five"

DATA_DAY = "data_day"

refresh_session_count = 100

Vol = 9

FIVE = [1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56]
FIFTEEN = [1, 16, 31, 46]
THIRTY = [1, 31]


NINE_AND_HALF_SECOND = 34200
FIFTEEN_SECOND = 54000

NINE_TIME_STAMP = int(time.mktime(
    datetime.date.today().timetuple())) + NINE_AND_HALF_SECOND
FIFTEEN_TIME_STAMP = int(time.mktime(
    datetime.date.today().timetuple())) + FIFTEEN_SECOND

COOKIES = 'xq_a_token=ad254175b8f79f3ce1be51812b24adb083dc9851; xqat=ad254175b8f79f3ce1be51812b24adb083dc9851; xq_r_token=55944e6d0310d70bf0039e421a9a722032a84077; xq_id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOi0xLCJpc3MiOiJ1YyIsImV4cCI6MTYzOTc2NDY2MCwiY3RtIjoxNjM3ODAyNzY0ODkyLCJjaWQiOiJkOWQwbjRBWnVwIn0.B36hD8YPfMaB5obs-AdVC79UHBOXhFF9w-NnsTwRZ8j44aM-YdYJVvpcNiNkFZbVdQ18pvsgk-CM6IuDpsFccpYv_C-3PPSM46YPLMPSFrxke3uDqeBZrjlCIXj8MoZbX4CkhvnMBv1oOvZXxNqcuP7O5vGZqR37dyDPzSSexDn18l7VU6N4YoEo-Ssv4hFbqi9q4m_w-Hz4kgGscKjSsqsoPBT7fIHxRArOgJDteuFoNBxaob4bk59k7huucnSO4aBNckowTOzjl22SqEBCdgmShE2WfySx9OzjelTfi32htHwK-AxuQX6dyqfO_B1kNaq4fxY6_CtopZRP5lZeMg; u=661637802810487; is_overseas=0; Hm_lvt_1db88642e346389874251b5a1eded6e3=1637802813; Hm_lpvt_1db88642e346389874251b5a1eded6e3=1637802813; device_id=2938f7da4aca1f5fb88deecf69a33b52'

STEP = 30

eflag = 1

ding_url1 = "https://oapi.dingtalk.com/robot/send?access_token=c4e1cfb51588b9e3751e71ccc71777a343c40d32aba0c52c3784d390684ca77a"
ding_url2 = "https://oapi.dingtalk.com/robot/send?access_token=219ee4a84c9dd4fd789819d8ec786eab07f2123d9b945e79a6bacd705c10e08b"
ding_url0 = "https://oapi.dingtalk.com/robot/send?access_token=379d1aa4b4840f483a0c0eadaf23f9f6598b89290f91dfd841145dec6bb53a69"
ding_urlyes = "https://oapi.dingtalk.com/robot/send?access_token=d0bacc2cf01564e16c22d21c5b9a935e583d282863a8bcd37daf013c4935f74d"
ding_urlban = "https://oapi.dingtalk.com/robot/send?access_token=b70ca54feb43188c0ece7c0f8773697c3d21f46cb0fdcc67785361507a99a13a"

HEADERS = {
    'origin': 'https://xueqiu.com', 'referer': 'https://xueqiu.com/', 'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br',
    'sec-ch-ua': '"Microsoft Edge";v="93", " Not;A Brand";v="99", "Chromium";v="93"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': "Windows",
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'dnt': '1'
}
YUANSU = ['磷', '氟', '锂', '氨', '硅']
CAILIAO = ['石墨', '石墨烯', '碳纤维' ]
XITU = ['稀土', '永磁']
XIAOJINSHU = ['铅', '锌', '钢铁', '煤炭']
NENGYUAN = ['锂电池', '钠电池', '氢电池', '燃料电池', '储能', '新能源', '石油', '天燃气', '氢能源']
DIAN = ['风电', '水力发电', '火电', '光伏', '热电', '电网', '电表', '核电', '变压器', '逆变器', '变流器']
BANDAOTI = ['芯片', '光刻胶', '光刻机', '靶材', '半导体设备', '晶圆制造', 'IC设计', 'IGBT']
HUAGONG = ['磷化工', '氟化工', '煤化工']
CAR = ['新能车', '特斯拉', '人工智能', '华为', '自动驾驶', '5G', '大数据']
MILITARY = ['军工', '航母', '战斗机']
MEDCINE = ['CDMO']
MO = ['数字经济', '多元金融', '互联网金融', '供应链金融', '电子发票']
SPORT = ['冬奥会', '杭州亚运会']
ARCHITECTURE = ['污水处理','装配式建筑','地下管网']
KEYS = []
KEYS.extend(YUANSU)
KEYS.extend(CAILIAO)
KEYS.extend(XITU)
KEYS.extend(XIAOJINSHU)
KEYS.extend(NENGYUAN)
KEYS.extend(DIAN)
KEYS.extend(BANDAOTI)
KEYS.extend(HUAGONG)
KEYS.extend(CAR)
KEYS.extend(MILITARY)
KEYS.extend(MEDCINE)
KEYS.extend(MO)
KEYS.extend(SPORT)
KEYS.extend(ARCHITECTURE)

HOT = ['数字经济', '多元金融', '互联网金融', '供应链金融']
